package com.android.videotest.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Pair;
import android.view.View;

import com.android.videotest.AutoPlayNextVideo;
import com.android.videotest.JzViewOutlineProvider;
import com.android.videotest.R;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import cn.jzvd.JZDataSource;
import cn.jzvd.Jzvd;
import cn.jzvd.JzvdStd;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        AutoPlayNextVideo videoView = findViewById(R.id.videoView);
//        HashMap<String,String> urls = new HashMap<>();
//        urls.put("视频1","http://baobab.kaiyanapp.com/api/v1/playUrl?vid=177937&resourceType=video&editionType=default&source=aliyun&playUrlType=url_oss");
//        urls.put("视频2", "http://baobab.kaiyanapp.com/api/v1/playUrl?vid=177627&resourceType=video&editionType=default&source=aliyun&playUrlType=url_oss");
//        videoView.setUp(new JZDataSource(urls), Jzvd.SCREEN_NORMAL);
//
        videoView.setOutlineProvider(new JzViewOutlineProvider(10));
        videoView.setClipToOutline(true);
        ArrayList<Pair<String, String>> pairs = new ArrayList<>();
        pairs.add(new Pair<>("http://baobab.kaiyanapp.com/api/v1/playUrl?vid=177937&resourceType=video&editionType=default&source=aliyun&playUrlType=url_oss","这支华尔街日报的短片，让你思考阅读的意义"));
        pairs.add(new Pair<>("http://baobab.kaiyanapp.com/api/v1/playUrl?vid=177627&resourceType=video&editionType=default&source=aliyun&playUrlType=url_oss", "猜广告系列：纯 CG 制造的自然美"));
        videoView.setUrls(pairs);
        videoView.setUp(pairs.get(0).first, pairs.get(0).second);
        videoView.startVideo();
    }
}
